<template>
  <el-card class="box-card">
    <template #header>
      <div class="card-header">
        <span>课程列表</span>
        
      </div>
    </template>
    <div  class="text item">
        <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="date" label="序号" />
        <el-table-column prop="name" label="课程名称"  />
        <el-table-column prop="time" label="创建时间" />
        <el-table-column label="可见状态">
          <template v-slot="scope">
          <el-switch
              active-value="1"
              inactive-value="0"
              v-model="scope.row.on"
              @change="changeSwitch(scope.row)">
          </el-switch>
        </template></el-table-column>
        <el-table-column label="操作">
          <el-button size="small" @click="bianji"  plain><el-icon><edit-pen /></el-icon></el-button>
          <el-button size="small" @click="ziyuanguanli"  plain><el-icon><files /></el-icon></el-button>
          <el-button size="small" @click="ziyuanbianpai" plain><el-icon><monitor /></el-icon></el-button>
          <el-button size="small" @click="kaike" plain><el-icon><school /></el-icon></el-button>
        </el-table-column>
    </el-table>
      <p>正在{{tableData.name}}</p>
    </div>
  </el-card>

</template>

<script>
import {EditPen,Files,Monitor,School} from '@element-plus/icons-vue'
export default {

  // eslint-disable-next-line vue/multi-word-component-names
  name: "lession",
  components:{
    EditPen,
    Files,
    Monitor,
    School
  },
  methods:{
    bianji(){

    },
    ziyuanguanli(){

    },
    ziyuanbianpai(){

    },
    kaike(){

    },
    changeSwitch (data) {
      if(data.on==1){
        this.$message({
          message:data.name+"现在是可见的",
          type:'success'
        })
      }else {
        this.$message({
          message:data.name+"现在不可见",
          type:'warning'
        })
      }

      }
  },
  data(){
    return{
      tableData:[
        {
          date:1,
          name:'Java程序设计',
          time:'2020-12-12',
        },
        {
          date:2,
          name:'Mysql数据库技术',
          time:'2021-12-11',
        },
        {
          date:3,
          name:'web前端开发基础',
          time:'2020-12-12',
        },
        {
          date:4,
          name:'web前端开发实战',
          time:'2020-12-12',
        },
      ]
    }
  },
}
// eslint-disable-next-line no-unused-vars
</script>

<style scoped>
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
  height: 400px;
}
</style>